﻿<div>
    <ul class="pagination">

        <li class="page-item @(!Model.HasPrev? "disabled":"")">
            <a asp-route-PageIndex="1"
               asp-route-sortBy="@ViewBag.SortBy"
               asp-route-searchString="@ViewBag.FilterString"
               class="page-link">
                <i class="fa fa-fast-backward"></i>
            </a>
        </li>

        <li class="page-item @(!Model.HasPrev? "disabled":"")">
            <a asp-route-PageIndex="@(Model.PageIndex -1)"
               asp-route-sortBy="@ViewBag.SortBy"
               asp-route-searchString="@ViewBag.FilterString"
               class="page-link">
                <i class="fa fa-step-backward"></i>
            </a>
        </li>

        <!--显示页码-->
        @for (var i = 1; i <= Model.PageCount; i++) {
            <li class="page-item @(i == Model.PageIndex ? "active" : "")">
                <a asp-route-PageIndex="@i"
                   asp-route-sortBy="@ViewBag.SortBy"
                   asp-route-searchString="@ViewBag.FilterString"
                   class="page-link">@i</a>
            </li>
        }

        <li class="page-item  @(!Model.HasNext? "disabled":"")">
            <a asp-route-PageIndex="@(Model.PageIndex + 1)"
               asp-route-sortBy="@ViewBag.SortBy"
               asp-route-searchString="@ViewBag.FilterString"
               class="page-link">
                <i class="fa fa-step-forward"></i>
            </a>
        </li>

        <li class="page-item  @(!Model.HasNext? "disabled":"")">
            <a asp-route-PageIndex="@Model.PageCount"
               asp-route-sortBy="@ViewBag.SortBy"
               asp-route-searchString="@ViewBag.FilterString"
               class="page-link">
                <i class="fa fa-fast-forward"></i>
            </a>
        </li>
    </ul>
</div>
